/*
 * @message: 描述
 * @Author: Roy
 * @Email: cx_love_xc@163.com
 * @Github: cx_love_xc@163.com
 * @Date: 2022-01-11 17:14:26
 * @LastEditors: Roy
 * @LastEditTime: 2022-01-16 17:29:35
 * @Deprecated: 否
 * @FilePath: /blog/src/front/container/component/list/index.jsx
 */
import React from 'react';
import styles from './index.module.scss'

const List = ({ schema }) => {
    const { children = [] } = schema;

    return (
        <div className="wrapper">
            <ul className={styles.list}>
                {
                    children.map((item, index) => {
                        const { attributes = {} } = item;
                        const { title, desc, imageUrl, link } = attributes;
                        return <li className={styles.item} key={index}>
                            <a href={link} className={styles.link}>
                                <img src={imageUrl} alt={title} className={styles.img} />
                                <h4 className={styles.title}>{title || '暂无标题'}</h4>
                                <p className={styles.desc}>{desc || '暂无描述'}</p>
                            </a>
                        </li>
                    })
                }
            </ul>
        </div>
    );
}

export default List;